<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/commonEdit.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<script language="JavaScript" src="${ctx}/scripts/common/prototype.js"></script>
<script type="text/javascript">
	var ACTION_URL="${ctx}/house_precinctAction.do?";
	var MANAGEORGMAIN_ACTION="${ctx}/house_manageOrgAction.do?";
	function init(){
		$('precinctList').src = ACTION_URL + "method=initPrecinctList&manageOrgId="+$F('manageOrgId');
	}

	//新建管理区
	function openNewPrecinct(){
		var url=ACTION_URL + "method=initPrecinctAdd&manageOrgId="+$F('manageOrgId');
		top.windowOpen(url, 'newPrecinct', '${key.addPrecinct}', 380, 380, true, "PrecinctEditIFrame");
	}

	//修改管理区
	function openEditPrecinct(){
		if( getPrecinctId() != "" ){
			var url=ACTION_URL + "method=initPrecinctEdit&precinctId="+getPrecinctId()+"&manageOrgId="+$F('manageOrgId');
			top.windowOpen(url, 'newPrecinct', '${key.modifyPrecinct}', 380, 380,true, "PrecinctEditIFrame");
		}else{
			ErrorAlert('${key.tipsByModify}');
		}
	}

	//弹出删除管理区提示窗口
	function showDelete(){
		if( getPrecinctId() == "" ){
			ErrorAlert('${key.tipsByDelete}');
		}else{
			AlarmConfirm('${key.tipsByDeleteConfirm}',"mainFrame","deletePrecinct");
		}
	}
	//执行删除
	function deletePrecinct(){
		var url=ACTION_URL + "method=deletePrecinct&precinctId="+getPrecinctId();
		var myAjax = new Ajax.Request(
	                   url,
	                   {method: 'post', parameters:"" , onComplete: showResponseDelete}
	                   );
	}
	//删除响应
	function showResponseDelete(transport){
		ajaxSubmitException(transport.responseText);
		if(transport.responseText=="false"){
			FailureAlert('${key.doFalse}');
		}else{
			reLoadIFrameListWithQuery();
		}
	}

	//修改管理处
	function openEditManageOrg(){
		if($F('manageOrgId')!=""){
			var url=MANAGEORGMAIN_ACTION + "method=initManageOrgEdit&manageOrgId="+$F('manageOrgId');
			top.windowOpen(url, 'editmanageOrg', '${key.modifyManageOrg}', 380, 360,true, "manageOrgditIFrame");
		}else{
			ErrorAlert('${key.tipsByDelete}');
		}
	}

	//获取当前选择的记录
	function getPrecinctId(){
		var obj=document.frames("precinctList").document.all;
		return obj.precinctId.value;
	}

	//重新加载列表页面,不保留条件的刷新
	function reLoadIFrameList(){
		var url= ACTION_URL + "method=initPrecinctList&manageOrgId="+$F('manageOrgId');
		$('precinctList').src=url;
	}

	//重新加载列表页面,保留查询条件的刷新
	function reLoadIFrameListWithQuery(){
		window.frames("precinctList").freshFrame();
	}
</script>
</head>
<body onload="init();">
<input type="hidden" id="manageOrgId" value="${manageOrgVO.keyword}">
<div class="container">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td>
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td><!-----------------------------搜索1----------------------------->
				<table border="0" cellspacing="0" cellpadding="0" width="100%"
					class="bg_search" id="search01">
					<tr>
						<td></td>
					</tr>
				</table>
				<!---------------------------------------------搜索end----------------------></td>
			</tr>
			<tr>
				<td class="bg_toolBar2">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td width="42%">&nbsp;</td>
						<td width="58%" align="right">
						<!--------------------------右边图标01----------------------------------->
						<table border="0" cellpadding="0" cellspacing="0" id="ico3">
							<tr>
								<td class="toolbarico"></td>
								<td class="toolbarico"><a href="#"
									onclick="openEditManageOrg();" onfocus="this.blur()"><img
									src="${ctx}/images/ico_amend.gif" border="0" align="absbottom"
									alt="${key.modifyCompany}" />&nbsp;</a></td>
							</tr>
						</table>
						<!--------------------------右边图标end----------------------------------->
						</td>
					</tr>
				</table>
				</td>
			</tr>
			<tr>
				<td valign="top">
				<div>
				<div id="affair" style="height:419px;overflow:auto;background:#fff;">
				<table width="100%" border="0" align="center" cellpadding="5"
					cellspacing="1" id="tab_subMenu1" class="aux_intable_color">
					<tr>
						<td colspan="4" class="aux_titletable">${key.manageOrg}</td>
					</tr>
					<tr>
						<td class="aux_intable_td1">${key.name}：</td>
						<td class="aux_intable_td2">${manageOrgVO.name}</td>
						<td class="aux_intable_td1">${key.principal}：</td>
						<td class="aux_intable_td2">${manageOrgVO.principal}</td>
					</tr>
					<tr>
						<td class="aux_intable_td1">${key.address}：</td>
						<td class="aux_intable_td2">${manageOrgVO.address}</td>
						<td class="aux_intable_td1">${key.telephone}：</td>
						<td class="aux_intable_td2">${manageOrgVO.telephone}</td>
					</tr>


					<tr>
						<td colspan="4" class="aux_titletable">${key.precinct}</td>
					</tr>
				</table>
				<table width="100%" border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td class="bg_toolBar">
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td width="40%">&nbsp;</td>
								<td width="60%" align="right">
								<!--------------------------右边图标01----------------------------------->
								<table border="0" cellpadding="0" cellspacing="0" id="ico3">
									<tr>
										<td class="toolbarico"><a href="#"
											onclick="openNewPrecinct();" onfocus="this.blur()"><img
											src="${ctx}/images/ico_newfile.gif" border="0"
											align="absbottom" alt="${key.addPrecinct}" />&nbsp;</a></td>
										<td class="toolbarico"><a href="#"
											onclick="openEditPrecinct();" onfocus="this.blur()"><img
											src="${ctx}/images/ico_amend.gif" border="0"
											align="absbottom" alt="${key.modifyPrecinct}" />&nbsp;</a></td>
										<td class="toolbarico"><a href="#"
											onClick="showDelete();" onFocus="this.blur()"><img
											src="${ctx}/images/ico_delete.gif" alt="${key.delete}" width="16"
											height="16" border="0" align="absbottom"></a></td>
									</tr>
								</table>

								</td>
							</tr>
						</table>
						</td>
					</tr>
					<tr>
						<td valign="top"><iframe id="precinctList" height="400PX"
							name="precinctList" frameborder="0" border="0" src=""
							width="100%"></iframe></td>
					</tr>
				</table>
				</div>
				</div>
			</tr>
		</table>
		</td>
	</tr>
</table>
</div>
</body>
</html>
